package com.jewaton.auth.sensitive;



import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Node {
	public char c;
	public int flag; //1 end, 2 part end, 0 more
	public List<Node> children=new ArrayList<Node>();
	
	public Node(char c, int flag) {
		this.c=c;
		this.flag=flag;
	}
	
	public static Node findNode(Node node, char c) {
		List<Node> nodes = node.children;
		Node rn = null;
		for (Node n : nodes) {
			if (n.c == c) {
				rn = n;
				break;
			}
		}
		return rn;
	}

	@Override
	public String toString() {
		return "char="+c+", flag="+flag+", children="+Arrays.toString(children.toArray());
	}
}
